<template>
  <div>
    <v-nav :current="3" :isEnShow="false"></v-nav>
    <img src="@/components/xinwen.png" alt="" style="width: 100%">
    <h1>{{listData.post_title}}</h1>
    <div class="main">
      <!-- <img :src="listData.src" alt=""> -->
      <div v-html="listData.post_content" style="text-align: left" v-if="isShow" id="contenT"></div>
    </div>
    <v-footer></v-footer>
  </div>
</template>

<script>
import $ from 'zepto'
import vNav from '@/components/nav/nav'
import vFooter from '@/components/footer'
import {mapGetters} from 'vuex'
import { getInfoData } from '@/services/api.js'
export default {
  name: 'news',
  data () {
    return {
      id: null,
      listData: [],
      isShow: false
    }
  },
  computed: {
    ...mapGetters({
      'lang': 'lang'
    })
  },
  components: {
    vNav,
    vFooter
  },
  methods: {
    _getChList (id) {
      let params = {
        id: id
      }
      getInfoData(params).then((res) => {
        console.log(res)
        this.isShow = true
        this.listData = res
      })
    },
    _getEnList () {
      console.log('2')
    },
    version (id) {
      if (this.lang === 1) {
        this._getChList(id)
      }
      if (this.lang === 2) {
        this._getEnList(id)
      }
    }
  },
  created () {
    this.id = this.$route.params.id
    this.version(this.id)
  },
  updated () {
    $('#contenT').find('img').css({'width': '8.4rem!important', 'display': 'block', 'height': 'auto!important', 'margin': '8px auto'})
  }
}
</script>

<style scoped lang="scss">
@import '../util/common.scss';
h1 {
  padding: 30rem/$font-size-base;
  font-size: 30rem/$font-size-base;
  letter-spacing: 1px;
  color: #333;
  font-weight: bolder;
  font-weight: normal;
  text-align: center
}
.main {
  padding: 0 30rem/$font-size-base;
  img {
    border: 0;
    width: 8.4rem!important;
    margin: 8px auto;
    display: block;
  }
  p {
    font-size: 24rem/$font-size-base;
    color: #666;
    letter-spacing: 2px;
    // text-indent: 20px;
    padding: 30rem/$font-size-base 0;
  }
}
</style>
